home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / sd-26.zip / sd.h < prev    next >
C/C++ Source or Header  |  1992-09-09  |  52KB  |  1,328 lines

  1. /* SD -- square dance caller's helper.
  2.  
  3.     Copyright (C) 1990, 1991, 1992  William B. Ackerman.
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 1, or (at your option)
  8.     any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     This is for version 25. */
  20.  
  21. #define TRUE 1
  22. #define FALSE 0
  23. #define NULLCONCEPTPTR (concept_descriptor *) 0
  24. #define NULLCALLSPEC (callspec_block *) 0
  25.  
  26. typedef int long_boolean;
  27.  
  28. /* We would like this to be a signed char, but not all compilers are fully ANSI compliant. */
  29. typedef short veryshort;
  30.  
  31. #include <setjmp.h>
  32. #include "database.h"
  33.  
  34. #define MAX_ERR_LENGTH 200
  35. #define MAX_FILENAME_LENGTH 80
  36. #define MAX_PEOPLE 24
  37.  
  38. /* Probability (out of 8) that a concept will be placed on a randomly generated call. */
  39. #define CONCEPT_PROBABILITY 2
  40.  
  41. /* Absolute maximum length we can handle in text operations, including
  42.    writing to file.  If a call gets more complicated than this, stuff
  43.    will simply not be written to the file.  Too bad. */
  44. #define MAX_TEXT_LINE_LENGTH 200
  45.  
  46. /* This defines a person in a setup.  Unfortunately, there is too much data to fit into 32 bits. */
  47. typedef struct {
  48.    int id1;       /* Frequently used bits go here. */
  49.    int id2;       /* Bits used for evaluating predicates. */
  50. } personrec;
  51.  
  52. /* Person bits for "id1" field are:
  53.  20 000 000 000 -
  54.  10 000 000 000 - 
  55.   4 000 000 000 - 
  56.   2 000 000 000 -
  57.   1 000 000 000 -
  58.     400 000 000 - roll direction is CCW
  59.     200 000 000 - roll direction is neutral
  60.     100 000 000 - roll direction is CW
  61.      40 000 000 -
  62.      20 000 000 -
  63.      10 000 000 -
  64.       4 000 000 -
  65.       2 000 000 -
  66.       1 000 000 -
  67.         400 000 -
  68.         200 000 -
  69.         100 000 -
  70.          40 000 -
  71.          20 000 -
  72.          10 000 -
  73.           4 000 - 
  74.           2 000 - virtual person (created by tandem/couples concept, can't print out)
  75.           1 000 - live person (just so at least one bit is always set)
  76.             700 - these 3 bits identify actual person
  77.              60 - these 2 bits must be clear for rotation
  78.              10 - part of rotation (facing north/south)
  79.               4 - bit must be clear for rotation
  80.               2 - part of rotation
  81.               1 - part of rotation (facing east/west)
  82. */
  83.  
  84. #define ROLLBITS    0700000000
  85. #define ROLLBITL    0400000000
  86. #define ROLLBITM    0200000000
  87. #define ROLLBITR    0100000000
  88. #define BIT_VIRTUAL 02000
  89. #define BIT_PERSON  01000
  90. #define d_mask  01013
  91. #define d_north 01010
  92. #define d_south 01012
  93. #define d_east  01001
  94. #define d_west  01003
  95.  
  96. /* Person bits for "id2" field are:
  97.  20 000 000 000 -
  98.  10 000 000 000 - 
  99.   4 000 000 000 - center 2
  100.   2 000 000 000 - belle
  101.   1 000 000 000 - beau
  102.     400 000 000 - center 6
  103.     200 000 000 - outer 2
  104.     100 000 000 - outer 6
  105.      40 000 000 - trailer
  106.      20 000 000 - leader
  107.      10 000 000 - not side girl
  108.       4 000 000 - not side boy
  109.       2 000 000 - not head girl
  110.       1 000 000 - not head boy
  111.         400 000 - head corner
  112.         200 000 - side corner
  113.         100 000 - head
  114.          40 000 - side
  115.          20 000 - boy
  116.          10 000 - girl
  117.           4 000 - center
  118.           2 000 - end
  119.           1 000 - near column
  120.             400 - near line
  121.             200 - near box
  122.             100 - far column
  123.              40 - far line
  124.              20 - far box
  125.              10 -
  126.               4 -
  127.               2 -
  128.               1 -
  129. */
  130.  
  131. #define ID2_CTR2    04000000000
  132. #define ID2_BELLE   02000000000
  133. #define ID2_BEAU    01000000000
  134. #define ID2_CTR6     0400000000
  135. #define ID2_OUTR2    0200000000
  136. #define ID2_OUTR6    0100000000
  137. #define ID2_TRAILER   040000000
  138. #define ID2_LEAD      020000000
  139. #define ID2_NSG       010000000
  140. #define ID2_NSB        04000000
  141. #define ID2_NHG        02000000
  142. #define ID2_NHB        01000000
  143. #define ID2_HCOR        0400000
  144. #define ID2_SCOR        0200000
  145. #define ID2_HEAD        0100000
  146. #define ID2_SIDE         040000
  147. #define ID2_BOY          020000
  148. #define ID2_GIRL         010000
  149. #define ID2_CENTER        04000
  150. #define ID2_END           02000
  151. #define ID2_NEARCOL       01000
  152. #define ID2_NEARLINE       0400
  153. #define ID2_NEARBOX        0200
  154. #define ID2_FARCOL         0100
  155. #define ID2_FARLINE         040
  156. #define ID2_FARBOX          020
  157.  
  158.  
  159. typedef struct {
  160.    setup_kind skind;
  161.    int srotation;
  162. } small_setup;
  163.  
  164. /* Flags that reside in the "setupflags" word of a setup BEFORE a call is executed.
  165.  
  166.    BEWARE!! These flags co-exist in the setupflags word with copies of some
  167.    of the call invocation flags.  The mask for those flags is
  168.    DFM_CONCENTRICITY_FLAG_MASK.  Those flags, and that mask, are defined
  169.    in database.h .  We define these flags at the extreme left end of the
  170.    word in order to keep them away from the concentricity flags.
  171.  
  172.    SETUPFLAG__OFFSET_Z means that we are doing a 2x3 call (the only known case
  173.    of this is "Z axle") that came from Z's picked out of a 4x4 setup.  The map
  174.    that we are using has a "50% offset" map schema, so that, if the call goes
  175.    into 1x4's (which Z axle does) it will put the results into a parallelogram,
  176.    in accordance with customary usage.  The problem is that, if the call goes
  177.    into a setup other than a 1x4 oriented in the appropriate way, using the
  178.    50% offset schema will lead to the wrong result.  For example, if a call
  179.    were defined that went from Z's into 2x2's, the program would attempt to
  180.    bizarrely offset boxes.  (Yes, I know that Z axle is the only call in the
  181.    database that can cause Z's to be picked out of a 4x4.  The program is just
  182.    trying to be very careful.)  So, when this flag is on and a shape-changer
  183.    occurs, the program insists on a parallelogram result.
  184.  
  185.    SETUPFLAG__SAID_SPLIT means that we are at a level of recursion in which
  186.    the "split" concept has been used.  When this is on, it is not permissible
  187.    to do a 4-person call that has not 8-person definition, and hence would have
  188.    been done the same way without the "split" concept.  This prevents superfluous
  189.    things like "split pass thru".
  190.  
  191.    SETUPFLAG__SAID_TRIANGLE means that we are at a level of recursion in which
  192.    the word "triangle" has been uttered, so it is OK to do things like "triangle
  193.    peel and trail" without giving the explicit "triangle" concept again.  This
  194.    makes it possible to say things like "tandem-based triangles peel and trail".
  195.  
  196.    SETUPFLAG__FRACTIONALIZE_MASK is a 9 bit field that is nonzero when some form
  197.    of fractionalization control is in use.  These bits are set up by concepts like
  198.    "random" and "fractional", and are used in sdmoves.c to control sequentially
  199.    defined calls.  See the comments there for details.
  200.  
  201.    SETUPFLAG__ELONGATE_MASK is a 2 bit field that tells, for a 2x2 setup prior to
  202.    having a call executed, how that 2x2 is elongated (due to these people
  203.    being the outsides) in the east-west or north-south direction.  Since 2x2's are
  204.    always totally canonical, the interpretation of the elongation direction is
  205.    always absolute.  A 1 in this field means the elongation is east-west.  A 2
  206.    means the elongation is north-south.  A zero means the elongation is unknown.
  207.  
  208.    SETUPFLAG__DISTORTED means that we are at a level of recursion in which some distorted-setup
  209.    concept has been used.  When this is set, "matrix" (a.k.a. "space invader")
  210.    calls, such as press and truck, are not permitted.  Sorry, Clark.
  211.  
  212.    SETUPFLAG__PHANTOMS means that we are at a level of recursion in which some phantom concept
  213.    has been used.  When this is set, the "tandem" or "as couples" concepts will
  214.    forgive phantoms wherever they might appear, so that "split phantom lines tandem
  215.    <call>" is legal.  Otherwise, we would have to say "split phantom lines phantom
  216.    tandem <call>.
  217.  
  218.    SETUPFLAG__NO_STEP_TO_WAVE means that we are at a level of recursion that no longer permits us to do the
  219.    implicit step to a wave or rear back from one that some calls permit at the top level.
  220.  
  221.    SETUPFLAG__DOING_ENDS means that this call is directed only to the ends (and the setup is the ends
  222.    of the original setup.  If the call turns out to be an 8-person call with distinct
  223.    centers and ends parts, we may want to just apply the ends part.  This is what
  224.    makes "ends detour" work.
  225. */
  226.  
  227. #define SETUPFLAG__OFFSET_Z           0x00004000
  228. #define SETUPFLAG__SAID_SPLIT         0x00008000
  229. #define SETUPFLAG__SAID_TRIANGLE      0x00010000
  230. /* This one is a 9 bit field -- FRACTIONALIZE_BIT tells where its low bit lies. */
  231. #define SETUPFLAG__FRACTIONALIZE_MASK 0x03FE0000
  232. #define SETUPFLAG__FRACTIONALIZE_BIT  0x00020000
  233. /* This one is a 2 bit field -- ELONGATE_BIT tells where its low bit lies. */
  234. #define SETUPFLAG__ELONGATE_MASK      0x0C000000
  235. #define SETUPFLAG__ELONGATE_BIT       0x04000000
  236. #define SETUPFLAG__DISTORTED          0x10000000
  237. #define SETUPFLAG__PHANTOMS           0x20000000
  238. #define SETUPFLAG__NO_STEP_TO_WAVE    0x40000000
  239. #define SETUPFLAG__DOING_ENDS         0x80000000
  240.  
  241. /* Flags that reside in the "setupflags" word of a setup AFTER a call is executed.
  242.    There shouldn't be a problem of conflict with the "before" flags, but we take
  243.    no chances.
  244.  
  245.    RESULTFLAG__EXPAND_TO_2X3 means that a call was executed that takes a four person
  246.    starting setup (typically a line) and yields a 2x3 result setup.  Two of those
  247.    result spots will be phantoms, of course.  When recombining a divided setup in
  248.    which such a call was executed, if the recombination wuold yield a 2x6, and if
  249.    the center 4 spots would be empty, this flag directs divided_setup_move to
  250.    collapse the setup to a 2x4.  This is what makes calls like "pair the line"
  251.    and "step and slide" behave correctly from parallel lines and from a grand line.
  252.  
  253.    RESULTFLAG__DID_LAST_PART means that, when a sequentially defined call was executed
  254.    with the SETUPFLAG__FRACTIONALIZE_MASK nonzero, so that just one part was done,
  255.    that part was the last part.  Hence, if we are doing a call with some "piecewise"
  256.    or "random" concept, we do that parts of the call one at a time, with appropriate
  257.    concepts on each part, until it comes back with this flag set.
  258.  
  259.    RESULTFLAG__ELONGATE_MASK is a 2 bit field that tells, for a 2x2 setup after
  260.    having a call executed, how that 2x2 is elongated in the east-west or
  261.    north-south direction.  Since 2x2's are always totally canonical, the
  262.    interpretation of the elongation direction is always absolute.  A 1 in this
  263.    field means the elongation is east-west.  A 2 means the elongation is
  264.    north-south.  A zero means the elongation is unknown.  These bits will be set
  265.    whenever we know which elongation is preferred.  This will be the case if the
  266.    setup was an elongated 2x2 prior to the call (because they are the ends), or
  267.    the setup was a 1x4 prior to the call.  So, for example, after any recycle
  268.    from a wave, these bits will be set to indicate that the dancers want to
  269.    elongate the 2x2 perpendicular to their original wave.  These bits will be
  270.    looked at only if the call was directed to the ends (starting from a grand
  271.    wave, for example.)  Furthermore, the bits will be overridden if the
  272.    "concentric" or "checkpoint" concepts were used, or if the ends did this
  273.    as part of a concentrically defined call for which some forcing modifier
  274.    such as "force_columns" was used.
  275.  
  276. ******** not true any longer VVVVVVVV *********
  277.    RESULTFLAG__PAR_CONC_END means that, if the call just executed went from a
  278.    2x2 to a 2x2, the call desires that the elongation change, or if the call just
  279.    executed went from a 1x4/diamond to a 2x2, the call desires that the elongation
  280.    be parallel to the original long axis.  The defaults for such calls are, for
  281.    2x2->2x2, that the elongation remain, and, for 1x4->2x2, that the elongation
  282.    be perpendicular to the long axis.  Whatever the outcome of this flag or the
  283.    default, it can be overriden by various concentric invocation flags, or by
  284.    the "concentric" and "checkpoint" concepts.  In general, this flag is taken
  285.    from the corresponding flag in the call definition.  HOWEVER: this is done only
  286.    for calls that are defined for 2x2->2x2 or 1x4->2x2 or dmd->2x2.  If the call
  287.    is defined for 1x2->1x2 and finds itself being executed on a 1x4 or 2x2 (by
  288.    subdividing the setup), the flag from the calls database is IGNORED.  In such
  289.    a case, RESULTFLAG__PAR_CONC_END will be cleared for a 2x2->2x2 transformation
  290.    and set for a 1x4->2x2 transformation, in each case indicating the the call
  291.    desires the elongation to stay the same.
  292.  
  293.    RESULTFLAG__PAR_CONC_UNK means that it is unknown what
  294.    the state of RESULTFLAG__PAR_CONC_END should be, that is, if the call just
  295.    executed went to a 2x2, it is not known what elongation the call prefers.
  296.    This will never be set for any existing calls.  Only compound calls that
  297.    go through an intermediate state which is a star could cause this.
  298. ******** not true any longer ^^^^^^^^ *********
  299.  
  300.    RESULTFLAG__NEED_DIAMOND means that a call has been executed with the "magic" or
  301.    "interlocked" modifier, and it really should be changed to the "magic diamond"
  302.    concept.  Otherwise, we might end up saying "magic diamond single wheel" when
  303.    we should have said "magic diamond, diamond single wheel".
  304. */
  305.  
  306. #define RESULTFLAG__EXPAND_TO_2X3   0x00000002
  307. #define RESULTFLAG__DID_LAST_PART   0x00000004
  308. /* This one is a 2 bit field -- ELONGATE_BIT tells where its low bit lies. */
  309. #define RESULTFLAG__ELONGATE_MASK   0x00000018
  310. #define RESULTFLAG__ELONGATE_BIT    0x00000008
  311. #define RESULTFLAG__NEED_DIAMOND    0x00000020
  312.  
  313. /* It should be noted that the SETUPFLAG__XXX and RESULTFLAG__XXX bits have
  314.    nothing to do with each other.  They just happen to occupy the same word
  315.    before and after the call is executed, respectively.  It is not intended that
  316.    the flags resulting from one call be passed to the next.  In fact, that
  317.    would be incorrect.  The SETUPFLAG__XXX bits should start at zero at the
  318.    beginning of each call, and accumulate stuff as the call goes deeper into
  319.    recursion.  The RESULTFLAG__XXX bits should, in general, be the OR of the
  320.    bits of the components of a compound call, though this is not so for
  321.    RESULTFLAG__PAR_CONC_END. */
  322.  
  323.  
  324.  
  325. typedef struct {
  326.    setup_kind kind;
  327.    int setupflags;
  328.    personrec people[MAX_PEOPLE];
  329.    int rotation;
  330.    small_setup inner;
  331.    small_setup outer;
  332.    int outer_elongation;
  333. } setup;
  334.  
  335. /* BEWARE!!  If change these next definitions, be sure to update the definition of
  336.    "warning_strings" in sdutil.c . */
  337. #define warn__do_your_part        0
  338. #define warn__tbonephantom        1
  339. #define warn__ends_work_to_spots  2
  340. #define warn__awkward_centers     3
  341. #define warn__bad_concept_level   4
  342. #define warn__not_funny           5
  343. #define warn__hard_funny          6
  344. #define warn__unusual             7
  345. #define warn__rear_back           8
  346. #define warn__awful_rear_back     9
  347. #define warn__excess_split        10
  348. #define warn__lineconc_perp       11
  349. #define warn__dmdconc_perp        12
  350. #define warn__lineconc_par        13
  351. #define warn__dmdconc_par         14
  352. #define warn__xclineconc_perp     15
  353. #define warn__xcdmdconc_perp      16
  354. #define warn__ctrstand_endscpls   17
  355. #define warn__ctrscpls_endstand   18
  356. #define warn__each2x2             19
  357. #define warn__each1x4             20
  358. #define warn__each1x2             21
  359. #define warn__take_right_hands    22
  360. #define warn__ctrs_are_dmd        23
  361. #define warn__full_pgram          24
  362. #define warn__offset_gone         25
  363. #define warn__overlap_gone        26
  364. #define warn__to_o_spots          27
  365. #define warn__to_x_spots          28
  366. #define warn__some_rear_back      29
  367. #define warn__not_tbone_person    30
  368. #define warn__check_c1_phan       31
  369. #define warn__check_dmd_qtag      32
  370. #define warn__check_2x4           33
  371. #define warn__check_pgram         34
  372.  
  373.  
  374. /* BEWARE!!  The warning numbers in this set must all be <= 31.  This is a
  375.    mask that is checked against the first word in the warning struct.
  376.    It just isn't worth doing this the really right way. */
  377. #define Warnings_That_Preclude_Searching (1<<warn__do_your_part | 1<<warn__ends_work_to_spots | 1<<warn__awkward_centers | \
  378.                                           1<<warn__hard_funny   | 1<<warn__rear_back          | 1<<warn__awful_rear_back | \
  379.                                           1<<warn__excess_split | \
  380.                                           1<<warn__unusual      | 1<<warn__bad_concept_level  | 1<<warn__not_funny)
  381.  
  382. /* BEWARE!!  The warning numbers in this set must all be <= 31.  This is a
  383.    mask that is cleared if a concentric call was done and the "suppress_elongation_warnings"
  384.    flag was on.  It just isn't worth doing this the really right way. */
  385. #define Warnings_About_Conc_elongation   (1<<warn__lineconc_perp | 1<<warn__dmdconc_perp    | 1<<warn__lineconc_par | \
  386.                                           1<<warn__dmdconc_par   | 1<<warn__xclineconc_perp | 1<<warn__xcdmdconc_perp)
  387.  
  388.  
  389. /* BEWARE!!  If change this next definition, be sure to update the definition of
  390.    "resolve_names" in SDTABLES. */
  391. typedef enum {
  392.    resolve_none,
  393.    resolve_rlg, resolve_la,
  394.    resolve_ext_rlg, resolve_ext_la,
  395.    resolve_circ_rlg, resolve_circ_la,
  396.    resolve_pth_rlg, resolve_pth_la,
  397.    resolve_tby_rlg, resolve_tby_la,
  398.    resolve_xby_rlg, resolve_xby_la,
  399.    resolve_dixie_grand,
  400.    resolve_prom
  401. } resolve_kind;
  402.  
  403. typedef struct {
  404.    resolve_kind kind;
  405.    int distance;
  406. } resolve_indicator;
  407.  
  408. typedef enum {
  409.    mode_none,     /* Not a real mode; used only for
  410.                      fictional purposes in the user interface;
  411.                      never appears in the rest of the program. */
  412.    mode_normal,
  413.    mode_startup,
  414.    mode_resolve
  415. } mode_kind;
  416.  
  417. typedef enum {
  418.     modify_popup_any,
  419.     modify_popup_only_tag,
  420.     modify_popup_only_scoot
  421. } modify_popup_kind;
  422.  
  423. /* These are the values returned by "uims_get_command". */
  424.  
  425. typedef enum {
  426.    ui_command_select,   /* (normal/resolve) User chose one of the special buttons like "resolve" or "quit". */
  427.    ui_resolve_select,   /* (resolve only) User chose one of the various actions peculiar to resolving. */
  428.    ui_start_select,     /* (startup only) User chose something. This is the only outcome in startup mode. */
  429.    ui_concept_select,   /* (normal only) User clicked in the miscellaneous concept menu. */
  430.    ui_call_select,      /* (normal only) User clicked in the current call menu. */
  431.    ui_special_concept   /* (normal only) User clicked in the menu of special concept popup names. */
  432. } uims_reply;
  433.  
  434. /* In each case, an integer or enum is deposited into the global variable uims_menu_index.  Its interpretation
  435.    depends on which of the replies above was given.  For some of the replies, it gives the index
  436.    into a menu.  For "ui_start_select" it is a start_select_kind.
  437.    For other replies, it is one of the following constants: */
  438.  
  439. /* BEWARE!!  This list may need to track some stuff in sdui.c and/or sd.dps . */
  440. /* BEWARE!!  This list must track all the "startinfolist" definitions in sdtables.c . */
  441. typedef enum {
  442.    start_select_exit,        /* Don't start a sequence; exit from the program. */
  443.    start_select_h1p2p,       /* Start with Heads 1P2P. */
  444.    start_select_s1p2p,       /* Etc. */
  445.    start_select_heads_start,
  446.    start_select_sides_start,
  447.    start_select_as_they_are
  448. } start_select_kind;
  449. #define NUM_START_SELECT_KINDS (((int) start_select_as_they_are)+1)
  450.  
  451. /* For ui_command_select: */
  452. typedef enum {
  453.    command_quit,
  454.    command_undo,
  455.    command_abort,
  456.    command_allow_modification,
  457.    command_create_comment,
  458.    command_change_outfile,
  459.    command_getout,
  460.    command_resolve,
  461.    command_reconcile,
  462.    command_anything,
  463.    command_nice_setup,
  464.    command_neglect,
  465.    command_save_pic
  466. } command_kind;
  467. #define NUM_COMMAND_KINDS (((int) command_save_pic)+1)
  468.  
  469. /* For ui_resolve_select: */
  470. typedef enum {
  471.    resolve_command_abort,
  472.    resolve_command_find_another,
  473.    resolve_command_goto_next,
  474.    resolve_command_goto_previous,
  475.    resolve_command_accept,
  476.    resolve_command_raise_rec_point,
  477.    resolve_command_lower_rec_point
  478. } resolve_command_kind;
  479. #define NUM_RESOLVE_COMMAND_KINDS (((int) resolve_command_lower_rec_point)+1)
  480.  
  481. /* BEWARE!!  There may be tables in the user interface file keyed to this enumeration. */
  482. /* In particular, this list must track the array "menu_names" in sdtables.c . */
  483. typedef enum {
  484.    call_list_none, call_list_empty, /* Not real call list kinds; used only for
  485.                                        fictional purposes in the user interface;
  486.                        never appear in the rest of the program. */
  487.    call_list_any,                   /* This is the "universal" call list; used
  488.                                        whenever the setup isn't one of the known ones. */
  489.    call_list_1x8, call_list_l1x8,
  490.    call_list_dpt, call_list_cdpt,
  491.    call_list_rcol, call_list_lcol,
  492.    call_list_8ch, call_list_tby,
  493.    call_list_lin, call_list_lout,
  494.    call_list_rwv, call_list_lwv,
  495.    call_list_r2fl, call_list_l2fl,
  496.    call_list_gcol, call_list_qtag
  497. } call_list_kind;
  498. #define NUM_CALL_LIST_KINDS (((int) call_list_qtag)+1)
  499.  
  500. /* BEWARE!!  
  501.    The last bunch of flags are pushed up against the high end of the word, so that
  502.    they can exactly match some other flags.  The constant HERITABLE_FLAG_MASK
  503.    embraces them.  The flags that must stay in step are in the "FINAL__XXX" group
  504.    in sd.h, the "cflag__xxx" group in database.h, and the "dfm_xxx" group in
  505.    database.h . There is compile-time code in sdinit.c to check that these
  506.    constants are all in step.
  507. */
  508.  
  509. #define FINAL__SPLIT                 0x00000001
  510. #define FINAL__SPLIT_SQUARE_APPROVED 0x00000002
  511. #define FINAL__SPLIT_DIXIE_APPROVED  0x00000004
  512. #define FINAL__MUST_BE_TAG           0x00000008
  513. #define FINAL__MUST_BE_SCOOT         0x00000010
  514. #define FINAL__TRIANGLE              0x00000020
  515. #define FINAL__SPLIT_SEQ_DONE        0x00000040
  516.  
  517. #define FINAL__DIAMOND               0x00400000
  518. #define FINAL__REVERSE               0x00800000
  519. #define FINAL__LEFT                  0x01000000
  520. #define FINAL__FUNNY                 0x02000000
  521. #define FINAL__INTERLOCKED           0x04000000
  522. #define FINAL__MAGIC                 0x08000000
  523. #define FINAL__GRAND                 0x10000000
  524. #define FINAL__12_MATRIX             0x20000000
  525. #define FINAL__CROSS                 0x40000000
  526. #define FINAL__SINGLE                0x80000000
  527.  
  528. typedef int final_set;
  529.  
  530. #define BASIC_CALLARRAY_SIZE 12
  531.  
  532. typedef long_boolean (*predicate_ptr)(
  533.    setup *real_people,
  534.    int real_index,
  535.    int real_direction,
  536.    int northified_index);
  537.  
  538. typedef struct glosk {
  539.    predicate_ptr pred;
  540.    short arr[BASIC_CALLARRAY_SIZE];
  541.    struct glosk *next;
  542. } predptr_pair;
  543.  
  544. typedef struct glork {
  545.    struct glork *next;
  546.    int callarray_flags;
  547.    call_restriction restriction;
  548.    search_qualifier qualifier;
  549.    begin_kind start_setup;
  550.    setup_kind end_setup;
  551.    setup_kind end_setup_in;             /* only if end_setup = concentric */
  552.    setup_kind end_setup_out;            /* only if end_setup = concentric */
  553.    union {
  554.       short def[BASIC_CALLARRAY_SIZE];  /* only if pred = false */
  555.       struct {                          /* only if pred = true */
  556.          predptr_pair *predlist; char errmsg[80];
  557.       } prd;
  558.    } stuff;
  559. } callarray;
  560.  
  561. typedef struct glonk {
  562.    char txt[80];
  563.    struct glonk *nxt;
  564. } comment_block;
  565.  
  566. typedef struct flonk {
  567.    char txt[80];
  568.    struct flonk *nxt;
  569. } outfile_block;
  570.  
  571. typedef int defmodset;
  572.  
  573. typedef struct {
  574.    short call_id;
  575.    defmodset modifiers;
  576. } by_def_item;
  577.  
  578. typedef struct glowk {
  579.    int modifier_set;
  580.    callarray *callarray_list;
  581.    struct glowk *next;
  582.    level modifier_level;
  583. } calldef_block;
  584.  
  585. typedef struct {
  586.    int callflags;
  587.    char *name;
  588.    int age;
  589.    calldef_schema schema;
  590.    union {
  591.       struct {
  592.          calldef_block *def_list;
  593.       } arr;            /* if schema = schema_by_array */
  594.       struct {
  595.          int flags;
  596.          short stuff[8];
  597.       } matrix;         /* if schema = schema_matrix or schema_partner_matrix */
  598.       struct {
  599.          by_def_item defarray[SEQDEF_MAX+1];
  600.       } def;            /* if schema = schema_by_def */
  601.       struct {
  602.          by_def_item innerdef;
  603.          by_def_item outerdef;
  604.       } conc;           /* if schema = schema_concentric, schema_concentric_6_2, schema_concentric_2_6, schema_cross_concentric, schema_concentric_diamond_line */
  605.    } stuff;
  606. } callspec_block;
  607.  
  608. /* BEWARE!!  This list must track all the "map_hunk" definitions in sdtables.c . */
  609. typedef enum {
  610.    MPKIND__NONE,
  611.    MPKIND__SPLIT,
  612.    MPKIND__REMOVED,
  613.    MPKIND__OVERLAP,
  614.    MPKIND__INTLK,
  615.    MPKIND__OFFS_L_HALF,
  616.    MPKIND__OFFS_R_HALF,
  617.    MPKIND__OFFS_L_FULL,
  618.    MPKIND__OFFS_R_FULL,
  619.    MPKIND__O_SPOTS,
  620.    MPKIND__X_SPOTS,
  621.    MPKIND__4_QUADRANTS,
  622.    MPKIND__DMD_STUFF
  623. } mpkind;
  624.  
  625. typedef struct {
  626.    veryshort map1[8];
  627.    veryshort map2[8];
  628.    veryshort map3[8];
  629.    veryshort map4[8];
  630.    mpkind map_kind;
  631.    int arity;
  632.    setup_kind outer_kind;
  633.    setup_kind inner_kind;
  634.    int rot;
  635.    int vert;
  636. } map_thing;
  637.  
  638. typedef map_thing *map_hunk[][2];
  639.  
  640. typedef struct {
  641.    setup_kind result_kind;
  642.    char xca[24];
  643.    char yca[24];
  644.    char numbers[8][8];
  645. } coordrec;
  646.  
  647.  
  648. /* BEWARE!!  This list must track the array "concept_table" in sd.c . */
  649. typedef enum {
  650.  
  651. /* These next few are not concepts.  Their appearance marks
  652.    the final end of the concept list.  It has a selector and number
  653.    specifier following, and then the call itself. */
  654.  
  655.    concept_another_call_next_mod,         /* calla modified by callb */
  656.    concept_another_call_next_modreact,    /* calla, which is a "scoot reaction" type, modified by callb */
  657.    concept_another_call_next_modtag,      /* calla, which is a "tag your neighbor" type, modified by callb */
  658.    concept_another_call_next_force,       /* calla, old subcall, changed to callb */
  659.    concept_mod_declined,                  /* user was queried about modification, and said no. */
  660.    marker_end_of_list,                    /* normal case */
  661.  
  662. /* This is not a concept.  Its appearance indicates a comment is to be placed here. */
  663.  
  664.    concept_comment,
  665.  
  666. /* Everything after this is a real concept. */
  667.  
  668.    concept_concentric,
  669.    concept_single_concentric,
  670.    concept_tandem,
  671.    concept_phantom_tandem,
  672.    concept_gruesome_tandem,
  673.    concept_some_are_tandem,
  674.    concept_checkerboard,
  675.    concept_reverse,
  676.    concept_left,
  677.    concept_grand,
  678.    concept_magic,
  679.    concept_cross,
  680.    concept_single,
  681.    concept_interlocked,
  682.    concept_12_matrix,
  683.    concept_funny,
  684.    concept_randomtrngl,
  685.    concept_selbasedtrngl,
  686.    concept_split,
  687.    concept_diamond,
  688.    concept_triangle,
  689.    concept_do_both_boxes,
  690.    concept_once_removed,
  691.    concept_do_phantom_2x2,
  692.    concept_do_phantom_boxes,
  693.    concept_do_phantom_diamonds,
  694.    concept_do_phantom_1x6,
  695.    concept_do_phantom_1x8,
  696.    concept_do_phantom_2x4,
  697.    concept_do_phantom_2x3,
  698.    concept_divided_2x4,
  699.    concept_divided_2x3,
  700.    concept_distorted,
  701.    concept_single_diagonal,
  702.    concept_double_diagonal,
  703.    concept_parallelogram,
  704.    concept_triple_lines,
  705.    concept_triple_lines_together,
  706.    concept_quad_lines,
  707.    concept_quad_lines_together,
  708.    concept_quad_boxes,
  709.    concept_quad_boxes_together,
  710.    concept_triple_boxes,
  711.    concept_triple_boxes_together,
  712.    concept_triple_diamonds,
  713.    concept_triple_diamonds_together,
  714.    concept_quad_diamonds,
  715.    concept_quad_diamonds_together,
  716.    concept_triple_diag,
  717.    concept_triple_diag_together,
  718.    concept_triple_twin,
  719.    concept_misc_distort,
  720.    concept_old_stretch,
  721.    concept_new_stretch,
  722.    concept_c1_phantom,
  723.    concept_grand_working,
  724.    concept_centers_or_ends,
  725.    concept_so_and_so_only,
  726.    concept_some_vs_others,
  727.    concept_stable,
  728.    concept_so_and_so_stable,
  729.    concept_standard,
  730.    concept_double_offset,
  731.    concept_checkpoint,
  732.    concept_on_your_own,
  733.    concept_trace,
  734.    concept_ferris,
  735.    concept_centers_and_ends,
  736.    concept_sequential,
  737.    concept_meta,
  738.    concept_so_and_so_begin,
  739.    concept_nth_part,
  740.    concept_replace_nth_part,
  741.    concept_interlace,
  742.    concept_fractional,
  743.    concept_rigger,
  744.    concept_callrigger
  745. } concept_kind;
  746.  
  747. /* These flags go into the "concept_prop" field of a "concept_table_item". */
  748.  
  749. /* This means that the concept takes a second call, so a sublist must
  750.    be created, with a pointer to same just after the concept pointer. */
  751. #define CONCPROP__SECOND_CALL     0x00000001
  752. /* This means that the concept requires a selector, which must be
  753.    inserted into the concept list just after the concept pointer. */
  754. #define CONCPROP__USE_SELECTOR    0x00000002
  755. /* These mean that the concept requires the indicated setup, and, at
  756.    the top level, the existing setup should be expanded as needed. */
  757. #define CONCPROP__NEED_4X4        0x00000004
  758. #define CONCPROP__NEED_2X8        0x00000008
  759. #define CONCPROP__NEED_2X6        0x00000010
  760. #define CONCPROP__NEED_4DMD       0x00000020
  761. #define CONCPROP__NEED_BLOB       0x00000040
  762. #define CONCPROP__NEED_4X6        0x00000080
  763. /* This means that phantoms are in use under this concept, so that,
  764.    when looking for tandems or couples, we shouldn't be disturbed if we
  765.    pair someone with a phantom.  It is what makes "split phantom lines tandem"
  766.    work, so that "split phantom lines phantom tandem" is unnecessary. */
  767. #define CONCPROP__SET_PHANTOMS    0x00000100
  768. /* This means that stepping to a wave or rearing back from one is not
  769.    allowed under this concept. */
  770. #define CONCPROP__NO_STEP         0x00000200
  771. /* This means that tbonetest & livemask need to be computed before executing the concept. */
  772. #define CONCPROP__GET_MASK        0x00000400
  773. /* This means that the concept can be "standard". */
  774. #define CONCPROP__STANDARD        0x00000800
  775. /* If a concept takes one number, only CONCPROP__USE_NUMBER is set.
  776.    If it takes two numbers both bits are set. */
  777. #define CONCPROP__USE_NUMBER      0x00001000
  778. #define CONCPROP__USE_TWO_NUMBERS 0x00002000
  779. #define CONCPROP__NEED_3DMD       0x00004000
  780.  
  781. typedef enum {    /* These control error messages that arise when we divide a setup
  782.                      into subsetups (e.g. phantom lines) and find that one of
  783.                      the setups is empty.  For example, if we are in normal lines
  784.                      and select "phantom lines", it will notice that one of the setups
  785.                      (the outer one) isn't occupied and will give the error message
  786.                      "Don't use phantom concept if you don't mean it." */
  787.  
  788.    phantest_ok,               /* Anything goes */
  789.    phantest_impossible,       /* Can't happen in symmetric stuff?? */
  790.    phantest_both,             /* Require both setups (partially) occupied */
  791.    phantest_only_one,         /* Require only one setup occupied, don't care which */
  792.    phantest_only_first_one,   /* Require only first setup occupied, second empty */
  793.    phantest_only_second_one,  /* Require only second setup occupied, first empty */
  794.    phantest_first_or_both,    /* Require first setup only, or a mixture */
  795.    phantest_2x2_both,
  796.    phantest_2x2_only_two,
  797.    phantest_not_just_centers
  798. } phantest_kind;
  799.  
  800. typedef enum {
  801.    disttest_t, disttest_nil, disttest_only_two,
  802.    disttest_any, disttest_offset, disttest_z} disttest_kind;
  803.  
  804. /* BEWARE!!  If change this next definition, be sure to update the definition of
  805.    "selector_names" and "selector_singular" in SDUTIL, and also necessary stuff in SDUI. */
  806. typedef enum {
  807.    selector_uninitialized,
  808.    selector_boys,
  809.    selector_girls,
  810.    selector_heads,
  811.    selector_sides,
  812.    selector_headcorners,
  813.    selector_sidecorners,
  814.    selector_headboys,
  815.    selector_headgirls,
  816.    selector_sideboys,
  817.    selector_sidegirls,
  818.    selector_centers,
  819.    selector_ends,
  820.    selector_leads,
  821.    selector_trailers,
  822.    selector_beaux,
  823.    selector_belles,
  824.    selector_center2,
  825.    selector_center6,
  826.    selector_outer2,
  827.    selector_outer6,
  828.    selector_nearline,
  829.    selector_farline,
  830.    selector_nearcolumn,
  831.    selector_farcolumn,
  832.    selector_nearbox,
  833.    selector_farbox,
  834.    selector_all,
  835.    selector_none
  836. } selector_kind;
  837. #define last_selector_kind ((int) selector_none)
  838.  
  839. typedef struct {
  840.    char *name;
  841.    concept_kind kind;
  842.    level level;
  843.    struct {
  844.       map_thing *maps;
  845.       int arg1;
  846.       int arg2;
  847.       int arg3;
  848.       int arg4;
  849.       int arg5;
  850.    } value;
  851. } concept_descriptor;
  852.  
  853. typedef enum {
  854.    simple_normalize,
  855.    normalize_before_isolated_call,
  856.    normalize_before_merge
  857. } normalize_level;
  858.  
  859. typedef struct glock {
  860.    concept_descriptor *concept;   /* the concept or end marker */
  861.    callspec_block *call;          /* if this is end mark, gives the call; otherwise unused */
  862.    struct glock *next;            /* next concept, or, if this is end mark, points to substitution list */
  863.    struct glock *subsidiary_root; /* for concepts that take a second call, this is its parse root */
  864.    struct glock *gc_ptr;          /* used for reclaiming dead blocks */
  865.    selector_kind selector;        /* selector, if any, used by concept or call */
  866.    int number;                    /* number, if any, used by concept or call */
  867. } parse_block;
  868.  
  869. typedef struct {
  870.    int bits[2];
  871. } warning_info;
  872.  
  873. typedef struct {           /* This record is one state in the evolving sequence. */
  874.    parse_block *command_root;
  875.    setup state;
  876.    resolve_indicator resolve_flag;
  877.    long_boolean draw_pic;
  878.    warning_info warnings;
  879.    int centersp;           /* only nonzero for history[1] */
  880.    int text_line;          /* how many lines of text existed after this item was written,
  881.                               only meaningful if "written_history_items" is >= this index */
  882. } configuration;
  883.  
  884. typedef struct {
  885.    parse_block **concept_write_save_ptr;
  886.    concept_kind save_concept_kind;
  887. } parse_stack_item;
  888.  
  889. typedef struct {
  890.    parse_stack_item parse_stack[40];
  891.    int parse_stack_index;
  892.    parse_block **concept_write_ptr;
  893.    parse_block **concept_write_base;
  894.    char *specialprompt;
  895.    int topcallflags;
  896.    call_list_kind call_list_to_use;
  897. } parse_state_type;
  898.  
  899. typedef struct {
  900.    int concept_prop;      /* Takes bits of the form CONCPROP__??? */
  901.    void (*concept_action)(setup *, parse_block *, setup *);
  902. } concept_table_item;
  903.  
  904. typedef enum {
  905.    file_write_no,
  906.    file_write_double
  907. } file_write_flag;
  908.  
  909. typedef enum {
  910.    call_list_mode_none,
  911.    call_list_mode_writing,
  912.    call_list_mode_writing_full,
  913.    call_list_mode_abridging
  914. } call_list_mode_t;
  915.  
  916. typedef struct {
  917.    char *name;
  918.    long_boolean into_the_middle;
  919.    setup the_setup;
  920. } startinfo;
  921.  
  922. /* BEWARE!!  This next definition is keyed to stuff in SDRESOLVE, particularly the array "title_string". */
  923. typedef enum {search_anything, search_nice_setup, search_resolve, search_reconcile} search_kind;
  924.  
  925. #define cross_by_level l_c1
  926. #define dixie_grand_level l_plus
  927.  
  928. typedef struct {           /* This is done to preserve the encapsulation of type "jmp_buf".                  */
  929.    jmp_buf the_buf;        /*   We are going to use pointers to these things.  If we simply used             */
  930. } real_jmp_buf;            /*   pointers to jmp_buf, the semantics would not be transparent if jmp_buf       */
  931.                            /*   were defined as an array.  The semantics of pointers to arrays are different */
  932.                            /*   from those of pointers to other types, and are not transparent.              */
  933.                            /*   In particular, we would need to look inside the include file to see what     */
  934.                            /*   underlying type jmp_buf is an array of, which would violate the principle    */
  935.                            /*   of type encapsulation.                                                       */
  936.  
  937.  
  938. /* Values returned by the various popup routines: */
  939. #define POPUP_DECLINE 0
  940. #define POPUP_ACCEPT  1
  941. #define POPUP_ACCEPT_WITH_STRING 2
  942.  
  943.  
  944. /* VARIABLES */
  945.  
  946. extern real_jmp_buf longjmp_buffer;                                 /* in SDUTIL */
  947. extern real_jmp_buf *longjmp_ptr;                                   /* in SDUTIL */
  948. extern configuration history[];                                     /* in SDUTIL */
  949. extern int history_ptr;                                             /* in SDUTIL */
  950. extern int written_history_items;                                   /* in SDUTIL */
  951. extern int written_history_nopic;                                   /* in SDUTIL */
  952. extern parse_block *last_magic_diamond;                             /* in SDUTIL */
  953. extern char error_message1[MAX_ERR_LENGTH];                         /* in SDUTIL */
  954. extern char error_message2[MAX_ERR_LENGTH];                         /* in SDUTIL */
  955. extern int collision_person1, collision_person2;                    /* in SDUTIL */
  956. extern long_boolean enable_file_writing;                            /* in SDUTIL */
  957. extern char *selector_names[];                                      /* in SDUTIL */
  958.  
  959. extern int global_tbonetest;                                        /* in SD */
  960. extern int global_livemask;                                         /* in SD */
  961. extern int global_selectmask;                                       /* in SD */
  962. extern concept_table_item concept_table[];                          /* in SD */
  963.  
  964. extern int general_concept_size;                                    /* in SDTABLES */
  965. extern int general_concept_offset;                                  /* in SDTABLES */
  966. extern int *concept_offset_tables[];                                /* in SDTABLES */
  967. extern int *concept_size_tables[];                                  /* in SDTABLES */
  968. extern char *concept_menu_strings[];                                /* in SDTABLES */
  969. extern callspec_block **main_call_lists[NUM_CALL_LIST_KINDS];       /* in SDTABLES */
  970. extern int number_of_calls[NUM_CALL_LIST_KINDS];                    /* in SDTABLES */
  971. extern level calling_level;                                         /* in SDTABLES */
  972. extern char *getout_strings[];                                      /* in SDTABLES */
  973. extern char *filename_strings[];                                    /* in SDTABLES */
  974. extern char *resolve_names[];                                       /* in SDTABLES */
  975. extern char *resolve_distances[];                                   /* in SDTABLES */
  976. extern char *menu_names[];                                          /* in SDTABLES */
  977. extern begin_kind keytab[][2];                                      /* in SDTABLES */
  978. extern coordrec *setup_coords[];                                    /* in SDTABLES */
  979. extern coordrec *nice_setup_coords[];                               /* in SDTABLES */
  980. extern int setup_limits[];                                          /* in SDTABLES */
  981. extern int begin_sizes[];                                           /* in SDTABLES */
  982. extern startinfo startinfolist[];                                   /* in SDTABLES */
  983.  
  984. extern map_thing map_b6_trngl;                                      /* in SDTABLES */
  985. extern map_thing map_s6_trngl;                                      /* in SDTABLES */
  986. extern map_thing map_2x2v;                                          /* in SDTABLES */
  987. extern map_thing map_4x4v;                                          /* in SDTABLES */
  988. extern map_thing map_2x4_magic;                                     /* in SDTABLES */
  989. extern map_thing map_qtg_magic;                                     /* in SDTABLES */
  990. extern map_thing map_qtg_intlk;                                     /* in SDTABLES */
  991. extern map_thing map_qtg_magic_intlk;                               /* in SDTABLES */
  992. extern map_thing map_ptp_magic;                                     /* in SDTABLES */
  993. extern map_thing map_ptp_intlk;                                     /* in SDTABLES */
  994. extern map_thing map_ptp_magic_intlk;                               /* in SDTABLES */
  995. extern map_thing map_4x4_ns;                                        /* in SDTABLES */
  996. extern map_thing map_4x4_ew;                                        /* in SDTABLES */
  997. extern map_thing map_offset;                                        /* in SDTABLES */
  998. extern map_thing map_ov_s2x4_k;                                     /* in SDTABLES */
  999. extern map_thing map_dbloff1;                                       /* in SDTABLES */
  1000. extern map_thing map_dbloff2;                                       /* in SDTABLES */
  1001. extern map_thing map_trngl_box1;                                    /* in SDTABLES */
  1002. extern map_thing map_trngl_box2;                                    /* in SDTABLES */
  1003. extern map_thing map_lh_s2x3_3;                                     /* in SDTABLES */
  1004. extern map_thing map_lh_s2x3_2;                                     /* in SDTABLES */
  1005. extern map_thing map_rh_s2x3_3;                                     /* in SDTABLES */
  1006. extern map_thing map_rh_s2x3_2;                                     /* in SDTABLES */
  1007. extern map_thing map_lf_s2x4_r;                                     /* in SDTABLES */
  1008. extern map_thing map_rf_s2x4_r;                                     /* in SDTABLES */
  1009. extern map_thing *maps_3diag[4];                                    /* in SDTABLES */
  1010. extern map_thing *maps_3diagwk[4];                                  /* in SDTABLES */
  1011. extern map_hunk *map_lists[][4];                                    /* in SDTABLES */
  1012.  
  1013. extern concept_descriptor special_magic;                            /* in SDTABLES */
  1014. extern concept_descriptor special_interlocked;                      /* in SDTABLES */
  1015. extern concept_descriptor mark_end_of_list;                         /* in SDTABLES */
  1016. extern concept_descriptor marker_decline;                           /* in SDTABLES */
  1017. extern concept_descriptor marker_concept_mod;                       /* in SDTABLES */
  1018. extern concept_descriptor marker_concept_modreact;                  /* in SDTABLES */
  1019. extern concept_descriptor marker_concept_modtag;                    /* in SDTABLES */
  1020. extern concept_descriptor marker_concept_force;                     /* in SDTABLES */
  1021. extern concept_descriptor marker_concept_comment;                   /* in SDTABLES */
  1022. extern concept_descriptor concept_descriptor_table[];               /* in SDTABLES */
  1023. extern int nice_setup_concept[];                                    /* in SDTABLES */
  1024.  
  1025. /*
  1026. extern comment_block *comment_root;
  1027. extern comment_block *comment_last;
  1028. */
  1029.  
  1030. extern int abs_max_calls;                                           /* in SDMAIN */
  1031. extern int max_base_calls;                                          /* in SDMAIN */
  1032. extern callspec_block **base_calls;                                 /* in SDMAIN */
  1033. extern char outfile_string[80];                                     /* in SDMAIN */
  1034. extern int last_file_position;                                      /* in SDMAIN */
  1035. extern int global_age;                                              /* in SDMAIN */
  1036. extern parse_state_type parse_state;                                /* in SDMAIN */
  1037. extern int uims_menu_index;                                         /* in SDMAIN */
  1038. extern char major_database_version[20];                             /* in SDMAIN */
  1039. extern char minor_database_version[20];                             /* in SDMAIN */
  1040. extern int whole_sequence_low_lim;                                  /* in SDMAIN */
  1041. extern long_boolean not_interactive;                                /* in SDMAIN */
  1042. extern long_boolean initializing_database;                          /* in SDMAIN */
  1043. extern long_boolean testing_fidelity;                               /* in SDMAIN */
  1044. extern selector_kind selector_for_initialize;                       /* in SDMAIN */
  1045.  
  1046. extern int random_number;                                           /* in SDSI */
  1047. extern int hashed_randoms;                                          /* in SDSI */
  1048.  
  1049. extern selector_kind current_selector;                              /* in PREDS */
  1050. extern long_boolean selector_used;                                  /* in PREDS */
  1051. extern long_boolean (*pred_table[])(                                /* in PREDS */
  1052.    setup *real_people,
  1053.    int real_index,
  1054.    int real_direction,
  1055.    int northified_index);
  1056.  
  1057.  
  1058. /* In SDMAIN */
  1059.  
  1060. extern parse_block *mark_parse_blocks(void);
  1061. extern void release_parse_blocks_to_mark(parse_block *mark_point);
  1062. extern void initialize_parse(void);
  1063. extern void save_parse_state(void);
  1064. extern long_boolean restore_parse_state(void);
  1065. extern parse_block *copy_parse_tree(parse_block *original_tree);
  1066. extern long_boolean deposit_call(callspec_block *call);
  1067. extern long_boolean deposit_concept(concept_descriptor *conc);
  1068. extern long_boolean query_for_call(void);
  1069. extern void get_real_subcall(
  1070.    parse_block *parseptr,
  1071.    by_def_item *item,
  1072.    final_set concin,
  1073.    parse_block **concptrout,
  1074.    callspec_block **callout,
  1075.    final_set *concout);
  1076.  
  1077. /* In PREDS */
  1078.  
  1079. extern long_boolean selectp(setup *ss, int place);
  1080.  
  1081. /* In SDINIT */
  1082.  
  1083. extern void initialize_menus(call_list_mode_t call_list_mode);
  1084.  
  1085. /* In SDSI */
  1086.  
  1087. extern void general_initialize(void);
  1088. extern int generate_random_number(int modulus);
  1089. extern long_boolean generate_random_concept_p(void);
  1090. extern void *get_mem(unsigned int siz);
  1091. extern void free_mem(void *ptr);
  1092. extern void get_date(char dest[]);
  1093. extern void unparse_number(int arg, char dest[]);
  1094. extern void open_file(void);
  1095. extern long_boolean probe_file(char filename[]);
  1096. extern void write_file(char line[]);
  1097. extern void close_file(void);
  1098. extern void print_line(char s[]);
  1099. extern void print_id_error(int n);
  1100. extern void init_error(char s[]);
  1101. extern void add_resolve_indices(char junk[], int cur, int max);
  1102. extern void final_exit(int code);
  1103. extern void open_database(void);
  1104. extern int read_from_database(void);
  1105. extern void close_database(void);
  1106. extern void fill_in_neglect_percentage(char junk[], int n);
  1107. extern int parse_number(char junk[]);
  1108. extern long_boolean open_call_list_file(call_list_mode_t call_list_mode, char filename[]);
  1109. extern char *read_from_call_list_file(char name[], int n);
  1110. extern void write_to_call_list_file(char name[]);
  1111. extern long_boolean close_call_list_file(void);
  1112.  
  1113. /* In SDUI */
  1114.  
  1115. extern void uims_process_command_line(int *argcp, char *argv[]);
  1116. extern void uims_preinitialize(void);
  1117. extern void uims_add_call_to_menu(call_list_kind cl, int call_menu_index, char name[]);
  1118. extern void uims_finish_call_menu(call_list_kind cl, char menu_name[]);
  1119. extern void uims_postinitialize(void);
  1120. extern int uims_do_outfile_popup(char dest[]);
  1121. extern int uims_do_comment_popup(char dest[]);
  1122. extern int uims_do_getout_popup(char dest[]);
  1123. extern int uims_do_abort_popup(void);
  1124. extern int uims_do_neglect_popup(char dest[]);
  1125. extern int uims_do_selector_popup(void);
  1126. extern int uims_do_quantifier_popup(void);
  1127. extern int uims_do_modifier_popup(char callname[], modify_popup_kind kind);
  1128. extern int uims_do_concept_popup(int kind);
  1129. extern void uims_reduce_line_count(int n);
  1130. extern void uims_add_new_line(char the_line[]);
  1131. extern uims_reply uims_get_command(mode_kind mode, call_list_kind call_menu, int modifications_flag);
  1132. extern void uims_update_resolve_menu(char *title);
  1133. extern void uims_terminate(void);
  1134. extern char *uims_version_string(void);
  1135.  
  1136. /* In SDUTIL */
  1137.  
  1138. extern void clear_screen(void);
  1139. extern void writestuff(char s[]);
  1140. extern void newline(void);
  1141. extern void doublespace_file(void);
  1142. extern void exit_program(int code);
  1143. extern void fail(char s[]);
  1144. extern void fail2(char s1[], char s2[]);
  1145. extern void specialfail(char s[]);
  1146. extern void string_copy(char **dest, char src[]);
  1147. extern void display_initial_history(int upper_limit, int num_pics);
  1148. extern void write_history_line(int history_index, char *header, long_boolean picture, file_write_flag write_to_file);
  1149. extern void warn(int w);
  1150. extern call_list_kind find_proper_call_list(setup *s);
  1151. extern callarray *assoc(begin_kind key, setup *ss, callarray *spec);
  1152. extern int find_calldef(
  1153.    callarray *tdef,
  1154.    setup *scopy,
  1155.    int real_index,
  1156.    int real_direction,
  1157.    int northified_index);
  1158. extern void clear_people(setup *z);
  1159. extern int rotperson(int n, int amount);
  1160. extern int rotcw(int n);
  1161. extern int rotccw(int n);
  1162. extern void clear_person(setup *resultpeople, int resultplace);
  1163. extern int copy_person(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace);
  1164. extern int copy_rot(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace, int rotamount);
  1165. extern void swap_people(setup *ss, int oneplace, int otherplace);
  1166. extern void install_person(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace);
  1167. extern void install_rot(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace, int rotamount);
  1168. extern parse_block *process_final_concepts(
  1169.    parse_block *cptr,
  1170.    long_boolean check_errors,
  1171.    final_set *final_concepts);
  1172. extern long_boolean fix_n_results(int arity, setup z[]);
  1173. extern void divided_setup_move(
  1174.    setup *ss,
  1175.    parse_block *parseptr,
  1176.    callspec_block *callspec,
  1177.    final_set final_concepts,
  1178.    map_thing *maps,
  1179.    phantest_kind phancontrol,
  1180.    long_boolean recompute_id,
  1181.    setup *result);
  1182. extern void overlapped_setup_move(setup *s, map_thing *maps,
  1183.    int m1, int m2, int m3, parse_block *parseptr, setup *result);
  1184.  
  1185. /* In SDGETOUT */
  1186.  
  1187. extern resolve_indicator resolve_p(setup *s);
  1188. extern uims_reply full_resolve(search_kind goal);
  1189.  
  1190. /* In SDBASIC */
  1191.  
  1192. extern void mirror_this(setup *s);
  1193.  
  1194. extern void basic_move(
  1195.    setup *ss,
  1196.    parse_block *parseptr,
  1197.    callspec_block *callspec,
  1198.    final_set final_concepts,
  1199.    int tbonetest,
  1200.    long_boolean fudged,
  1201.    setup *result);
  1202.  
  1203. /* In SDMOVES */
  1204.  
  1205. extern void reinstate_rotation(setup *ss, setup *result);
  1206. extern void canonicalize_rotation(setup *result);
  1207.  
  1208. extern void move(
  1209.    setup *ss,
  1210.    parse_block *parseptr,
  1211.    callspec_block *callspec,
  1212.    final_set final_concepts,
  1213.    long_boolean qtfudged,
  1214.    setup *result);
  1215.  
  1216. /* In SDISTORT */
  1217.  
  1218. extern void distorted_2x2s_move(
  1219.    setup *ss,
  1220.    parse_block *parseptr,
  1221.    setup *result);
  1222.  
  1223. extern void distorted_move(
  1224.    setup *ss,
  1225.    parse_block *parseptr,
  1226.    setup *result);
  1227.  
  1228. extern void triple_twin_move(
  1229.    setup *ss,
  1230.    parse_block *parseptr,
  1231.    setup *result);
  1232.  
  1233. extern void do_concept_rigger(
  1234.    setup *ss,
  1235.    parse_block *parseptr,
  1236.    setup *result);
  1237.  
  1238. extern void do_concept_callrigger(
  1239.    setup *ss,
  1240.    parse_block *parseptr,
  1241.    setup *result);
  1242.  
  1243. /* In SD12 */
  1244.  
  1245. extern void triangle_move(
  1246.    setup *s,
  1247.    parse_block *parseptr,
  1248.    setup *result);
  1249.  
  1250. /* In SD16 */
  1251.  
  1252. extern void phantom_2x4_move(
  1253.    setup *ss,
  1254.    int lineflag,
  1255.    phantest_kind phantest,
  1256.    map_thing *maps,
  1257.    parse_block *parseptr,
  1258.    setup *result);
  1259.  
  1260. /* In SD */
  1261.  
  1262. extern long_boolean do_big_concept(
  1263.    setup *ss,
  1264.    parse_block *parseptr,
  1265.    setup *result);
  1266.  
  1267. /* In SDTAND */
  1268.  
  1269. extern void tandem_couples_move(
  1270.    setup *ss,
  1271.    parse_block *parseptr,
  1272.    callspec_block *callspec,
  1273.    final_set final_concepts,
  1274.    selector_kind selector,
  1275.    long_boolean twosome,    /* normal=FALSE, twosome=TRUE */
  1276.    int phantom,             /* normal=0 phantom=1 gruesome=2 */
  1277.    int tnd_cpl_siam,        /* couples=0 tandem=1 siamese=2 */
  1278.    setup *result);
  1279.  
  1280. extern void initialize_tandem_tables(void);
  1281.  
  1282. /* In SDCONC */
  1283.  
  1284. extern void normalize_concentric(
  1285.    calldef_schema synthesizer,
  1286.    int center_arity,
  1287.    setup inners[],
  1288.    setup *outers,
  1289.    int outer_elongation,
  1290.    setup *result);
  1291.  
  1292. extern void normalize_setup(setup *ss, normalize_level level);
  1293.  
  1294. extern void concentric_move(
  1295.    setup *ss,
  1296.    parse_block *parsein,
  1297.    parse_block *parseout,
  1298.    callspec_block *callspecin,
  1299.    callspec_block *callspecout,
  1300.    final_set final_conceptsin,
  1301.    final_set final_conceptsout,
  1302.    calldef_schema analyzer,
  1303.    defmodset modifiersin,
  1304.    defmodset modifiersout,
  1305.    setup *result);
  1306.  
  1307. extern void merge_setups(setup *ss, setup *result);
  1308.  
  1309. extern void on_your_own_move(
  1310.    setup *ss,
  1311.    parse_block *parseptr,
  1312.    setup *result);
  1313.  
  1314. extern void so_and_so_only_move(
  1315.    setup *ss,
  1316.    parse_block *parseptr,
  1317.    setup *result);
  1318.  
  1319. /* In SDTOP */
  1320.  
  1321. extern void update_id_bits(setup *ss);
  1322.  
  1323. extern void touch_or_rear_back(
  1324.    setup *scopy,
  1325.    int callflags);
  1326.  
  1327. extern void toplevelmove(void);
  1328.